package com.bitBusy.manageyourriches.activity;

import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.ListView;

import com.bitBusy.manageyourriches.R;
import com.bitBusy.manageyourriches.database.managers.DatabaseInteractor;
import com.bitBusy.manageyourriches.utilityClasses.adapters.ScheduledExportsAdapter;
import com.bitBusy.manageyourriches.utilityClasses.navigation.ActionBarChoice;

public class ScheduledExportsActivity extends Activity {

private DatabaseInteractor myDBInteractor;
	
	private ListView myList;
	
	private static final String DATE = "NEXT EXPORT";
	
	private static final String PERIOD = "PERIOD";
	
	private static final String EMAIL = "e-MAIL";

	

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_scheduled_exports);
		myDBInteractor = new DatabaseInteractor(this);
		setView();

	}

	public void setView()
	{
		myList = (ListView) findViewById(R.id.activity_sched_exports_list);
		ArrayList<Object> reminders = new ArrayList<Object>();
		reminders.add(new ScheduledExportsAdapter.ScheduledExportsTitle(DATE, PERIOD, EMAIL));
		reminders.addAll(myDBInteractor.getAllRecurrentReminders());
		myList.setAdapter(new ScheduledExportsAdapter(this, reminders));
	}
	@Override
	  public boolean onCreateOptionsMenu(Menu the_menu) {
	    MenuInflater inflater = getMenuInflater();
	    inflater.inflate(R.menu.actionbar_menu, the_menu);
	    return true;
	  }
	 
	  
	  @Override
	  public boolean onOptionsItemSelected(MenuItem the_item) {
	    ActionBarChoice.choiceMade(this, the_item.getItemId());

	    return true;
	  }

}
